using System;
using System.Data;
using System.Configuration;
using System.Web;
using PccCommonForC;
using db_ShowRoom;

namespace bs_ShowRoom
{
    public class bs_menu : PccCommonForC.BsBaseObject
    {
        string mcon = "";
        public bs_menu(string connect)
        {
            mcon = connect;
        }
        private const string COMPONENTNAME = "bs_ShowRoom.bs_menu.";

        #region "Function"

        public override string DoReturnStr(string strCommand, string strXML, string strOther)
        {
            string strReturn = "";
            string strStartTime = DateTime.Now.ToString();
            switch (PccToolFunc.Upper(strCommand))
            {
                case "INSUPDPOWERUSER":
                      strReturn = bs_InsUpdPowerUser(strXML);
                    break;
                case "INSUPDMENUADMIN":
                    strReturn = bs_InsUpdMenuAdmin(strXML);
                    break;
                    
            }
            return strReturn;
        }



        public override DataSet DoReturnDataSet(string strCommand, string strXML, string strOther)
        {
            DataSet dsReturn = null;
            string strReturn = "";
            string strStartTime = DateTime.Now.ToString();

            switch (PccToolFunc.Upper(strCommand))
            {
                case "GETPOWESUSER":
                    dsReturn = bs_GetPowersUser(strXML);
                    break;
                case "GETMENUADMINBYSEARCH":
                    dsReturn = bs_GetMenuAdminBySearch(strXML);
                    break;
            
                    
            }

            if (dsReturn != null)
                strReturn = "DsFirstTableName---" + dsReturn.Tables[0].TableName;

            return dsReturn;
        }
        #endregion

        #region "InUpd Function"

        private string bs_InsUpdPowerUser(string strXML)
        {
            string strReturn;
            db_menu mydb = new db_menu(mcon);
            strReturn = mydb.db_InsUpdPowerUser(strXML);
            return strReturn;
        }
        private string bs_InsUpdMenuAdmin(string strXML)
        {
            string strReturn;
            db_menu mydb = new db_menu(mcon);
            strReturn = mydb.db_InsUpdMenuAdmin(strXML);
            return strReturn;
        }
        
        #endregion

        #region Get Function


        private DataSet bs_GetPowersUser(string strXML)
        {
            db_menu mydb = new db_menu(mcon);
            DataSet ds = mydb.db_GetPowersUser(strXML);

            return ds;
        }
        private DataSet bs_GetMenuAdminBySearch(string strXML)
        {
            db_menu mydb = new db_menu(mcon);
            DataSet ds = mydb.GetMenuAdminBySearch(strXML);

            return ds;
        }
        
        #endregion
    }
}
